#include <stdio.h>
#include "sequence-stack.h"

SeqStack MyStack;

int main(void){
    InitStack(&MyStack);

    ElemType Tmp = 0;

    while (Tmp >= 0){
        scanf("%d",&Tmp);
        Push(&MyStack,Tmp);
    }

    while (MyStack.top){
        Pop(&MyStack,&Tmp);
        printf("%d ",Tmp);
    }

    Pop(&MyStack,&Tmp);  //Out-of-bounds test
    printf("%d ",Tmp);

    while (MyStack.top){
        Pop(&MyStack,&Tmp);
        printf("%d ",Tmp);
    }

    DestroyStack(&MyStack);
    return(0);

}